{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>审核售后申请</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">售后原因：</label>
                            <div class="layui-input-block">
                                <textarea  class="layui-textarea" disabled>{$aftersale.bog_aftersale_reason}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">申请时间：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$aftersale.bog_aftersale_time}" class="layui-input" disabled>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">审核：</label>
                            <div class="layui-input-block">
                                <input type="radio" lay-filter="radio" name="bog_aftersale_status" value="3" class="layui-input" title="通过" checked/>
                                <input type="radio" lay-filter="radio" name="bog_aftersale_status" value="4" class="layui-input" title="拒绝"/>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 hidden" id="refuse">
                            <label class="layui-form-label">拒绝原因：</label>
                            <div class="layui-input-block">
                                <textarea  class="layui-textarea" name="refuse_reason"></textarea>
                            </div>
                        </div>

                        <input type="hidden" value="{$bog_id}" name="bog_id">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">确定
                                </button>
                                <!--<button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}
<script>
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('checkAftersale')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        });
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            });
        });

        form.on('radio(radio)', function(data){
            var check = $('input[name="bog_aftersale_status"]:checked').val();
            if(check == 3){
                $('#refuse').addClass('hidden');
            }else{
                $('#refuse').removeClass('hidden');
            }
        });

    });
</script>

</body>
</html>